<!--
 * @FileDescription 视角导航
 * @Author lz
 * @Date 20230223 15:37:23
 * @LastEditors lz
 * @LastEditTime 20230223 15:37:23
-->
<template>
    <div class="perspective_wp" v-if="state.show">
        <div class="tit">视角导航</div>
        <!-- <img src="/structure/DecorativeLine_r.png" class="line"> -->
        <img src="/structure/develop.png" class="develop" @click="show()">

    <div class="ContentBox">
        <div class="viewBox" v-for="(item, index) in AppraisalData.Default.ViewpointList.value" :key="index">
                <img :src="imgRun(item.Name)" class="viewBox_ico" @click="ViewConfig(item.Id)">
                <p>{{ item.Name }}</p>
            </div>

            <!-- <div class="check_box">
                        <a-checkbox v-model:checked="state.checked" class="check_text">显示现场定位点</a-checkbox>
                    </div> -->

        </div>
    </div>

    <div class="StowedState" v-if="!state.show" @click="show()">
        <img src="/structure/ExpandArrow_r.png" class="expArr">
    </div>
</template>

<script setup lang="ts">
import OrbitCameraComponent from '@components/Apps/InertialNavigation/OrbitCameraComponent';
import { ClientMessage } from '@runtime/generate/message/ClientMessage';
import WebSocketComponent from '@runtime/module/WebSocket/WebSocketComponent';
import { reactive, ref, toRefs, onBeforeMount, onMounted, onBeforeUpdate, onUpdated, onUnmounted, StyleValue, defineProps, defineEmits } from 'vue'
import AppraisalData from '../../appraisalSettings/appraisalSettings';
import { installContentResponse } from '../../installMenu/installMenu';
import MessageCode from '../../MessageCode';

const state = reactive({
    show: true,
    checked: ref(false)
});
function show() {
    state.show = !state.show
}
async function ViewConfig(Id: Number) {
    //获取视角数据
    let newArr: installContentResponse = await WebSocketComponent.Default.PostMessageAsync(new ClientMessage.CalibrationAdapterRequest(MessageCode.Default.MsgCodesList.VIEW_DATA_CONFIG, `${Id}`))
    console.log('获取的视角数据111111111111',JSON.parse(newArr.Content));
    console.log('AppraisalData.Default.ViewpointList.value2222222222222',AppraisalData.Default.ViewpointList.value);    
    let view = JSON.parse(newArr.Content).Result
    console.log('viewwwwwwww',view);    
    await OrbitCameraComponent.Default.UpdateV2Async(view.TargetContainer, view.Horizontal, view.Vertical, view.Distance, view.MinDistance, view.MaxDistance, view.RotateSensitivity, view.RotateSensitivity, view.ScrollSensitivity);
}
function imgRun(val: string) {
    return '/structure/' + val  + '.png'
}
onMounted(() => {
    ViewConfig(1)
})
</script>

<style scoped>
.perspective_wp {
    position: absolute;
    right: 0;
    top: 108px;
    width: 290px;
    height: 617px;
    background-image: url('/structure/cz_sjdh_bg.png');
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

.line {
    width: 272px;
    height: 28px;
    position: absolute;
    right: 8px;
    top: 32px;
}

.tit {
    text-align: right;
    font-size: 22px;
    font-family: YouSheBiaoTiHei;
    font-weight: 400;
    color: #ffffff;
    padding-right: 38px;
    padding-top: 12px;
    margin-bottom: 26px;
}

.develop {
    position: absolute;
    left: 4px;
    top: 14px;
    width: 27px;
    height: 32px;
}

.ContentBox {
    height: 484px;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.ContentBox::-webkit-scrollbar {
    /*滚动条整体样式*/
    width: 6px;
    /*高宽分别对应横竖滚动条的尺寸*/
    height: 1px;
}

.ContentBox::-webkit-scrollbar-thumb {
    /*滚动条里面小方块*/
    border-radius: 6px;
    background: #1AF2FF;
}

.ContentBox::-webkit-scrollbar-track {
    /*滚动条里面轨道*/
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
}

.viewBox {
    width: 50%;
    float: left;
    text-align: center;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #FFFFFF;

}

.viewBox_ico {
    width: 56px;
    height: 55px;
    margin-bottom: 12px;
    margin-top: 12px;
}

.check_box {
    text-align: center;
}

.StowedState {
    position: absolute;
    right: 0;
    top: 115px;
    width: 52px;
    height: 52px;
    background-image: url('/structure/stowedState_r_bg.png');
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

.expArr {
    width: 27px;
    height: 32px;
    margin-top: 10px;
    margin-left: 13px;
}

.check_text {
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #B1D0F4;
}
</style>